package item.inkcloud.resourceservice.controller;


import item.inkcloud.resourceservice.entity.Resource;
import item.inkcloud.resourceservice.mapper.ResoMapper;
import item.inkcloud.resourceservice.service.ResoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/resource")
public class ResoController {

    @Autowired
    private ResoService resoService;



    @RequestMapping("/publishResource")
    public HashMap publishResource(@RequestBody Resource resource,@RequestParam("userid")String userid){

            int status = resoService.publishResource(resource,userid);
            HashMap<String, Object> resultMap = new HashMap<>();
            resultMap.put("status", status);

            return resultMap;

    }




//获取资源列表
    @RequestMapping("/resourceList")
    public HashMap findAll(){

        HashMap resultMap = resoService.getResourceList();

        return resultMap;
    }

}





